<template>
  <view class="core-box" :style="{marginLeft:ml+'rpx'}" @click="handleClick()">
    <view class="image" :style='{background: bg}'>
      <image :src="url" mode=""></image>
    </view>
    <view class="title">
      {{title}}
    </view>
  </view>
</template>
<script>
  export default {
    props:{
      title:String,
      url:String,
      bg:String,
      ml:{
        type:Number,
        default:30,
      }
    },
    methods:{
      handleClick(){
        if(this.title=='我的社区')this.$emit('goCommunity');
        if(this.title == '校园周边')this.$emit('goSchoolInfo')
        if(this.title == '每日答题')this.$emit('goQuestions')
        if(this.title == '积分商城')this.$emit('goIntegralShop')
        if(this.title == '更多功能')this.$emit('goMore')
        if(this.title == '积分详情')this.$emit('goIntegralDetail')
      }
    }
  }
</script>
<style lang="scss">
  .core-box{
    width: 150rpx;
    height: 150rpx;
    margin: 20rpx 0;
    margin-left: 30rpx;
    
    .image{
      width: 64rpx;
      height: 64rpx;
      border-radius: 50%;
      margin: 0 auto;
      
      image{
        width: 100%;
        height: 100%;
      }
    }
    
    .title{
      margin-top: 30rpx;
      text-align: center;
      font-size: 26rpx;
      color: #555;
    }
  }
</style>
